package ua.com.jpy.entity.catagory.product;

import java.util.Date;
import java.util.Map;

import org.bson.types.ObjectId;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.format.annotation.DateTimeFormat;

import ua.com.jpy.entity.IEntity;
import ua.com.jpy.entity.catagory.product.attributset.AttributeSet;
import ua.com.jpy.entity.catagory.product.attributset.attribute.Attribute;

import com.google.code.morphia.annotations.Entity;
import com.google.code.morphia.annotations.Id;

/**
 * @author LSD25
 *
 */
@Entity(noClassnameStored = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class Product implements IEntity {
	
	@Id
	private ObjectId id;
	
	@NotBlank
	private AttributeSet attrSet;
	
	@NotEmpty
	private Map<String, Attribute> value;
	
	@NotBlank
	private double price;
	
	@DateTimeFormat
	private Date sellFrom;
	
	@DateTimeFormat
	private Date sellTo;
	
	private double superPrice;
	
	@DateTimeFormat
	private Date superSellFrom;
	
	@DateTimeFormat
	private Date superSellTo;
	
	@NotBlank
	private String type;
	
	private Map<ObjectId, Integer> countView;

	public ObjectId getId() {
		return id;
	}

	public void setId(ObjectId id) {
		this.id = id;
	}

	public AttributeSet getAttrSet() {
		return attrSet;
	}

	public void setAttrSet(AttributeSet attrSet) {
		this.attrSet = attrSet;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public Date getSellFrom() {
		return sellFrom;
	}

	public void setSellFrom(Date sellFrom) {
		this.sellFrom = sellFrom;
	}

	public Date getSellTo() {
		return sellTo;
	}

	public void setSellTo(Date sellTo) {
		this.sellTo = sellTo;
	}

	public double getSuperPrice() {
		return superPrice;
	}

	public void setSuperPrice(double superPrice) {
		this.superPrice = superPrice;
	}

	public Date getSuperSellFrom() {
		return superSellFrom;
	}

	public void setSuperSellFrom(Date superSellFrom) {
		this.superSellFrom = superSellFrom;
	}

	public Date getSuperSellTo() {
		return superSellTo;
	}

	public void setSuperSellTo(Date superSellTo) {
		this.superSellTo = superSellTo;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Map<ObjectId, Integer> getCountView() {
		return countView;
	}

	public void setCountView(Map<ObjectId, Integer> countView) {
		this.countView = countView;
	}
	
	public Map<String, Attribute> getValue() {
		return value;
	}

	public void setValue(Map<String, Attribute> value) {
		this.value = value;
	}
	
}
